<style src="../../style/statistics.css" scoped></style>
<template>
    <div class="containerTable">
        <Row class="divSearch">
        <!--搜索框-->
            <Col span="14">
                <label class="searchLabel">所属地区:</label>
                <Select v-model="searchModel.AreaCode"  placeholder="请选择..." class="searchInput"  @on-change="GetData()">
                    <Option :value="userInfo.AreaCode">{{(userInfo.AreaCode=='530000000000')?'全省':'全市（州）'}}</Option>
                    <Option :value="item.value" v-for="item in AreaList" :key="item.value">{{item.label}}</Option>
                </Select>                              
                <label class="searchLabel">填报年度:</label>
                <Select v-model="searchModel.FillInYear" placeholder="全部" class="searchInput" :label-in-value="true" @on-change="GetData()" >
                    <!-- <Option value="">全部</Option> -->
                    <Option :value="item.DictValue" v-for="item in CreateYearList" :key="item.DictValue">{{item.DictText}}</Option>
                </Select>
            </Col>                      
            <Col span="10" class="searchRight">    
                <Button class="searchButton" type="primary"   @click="Download(userInfo.AreaCode)">导出列表</Button>  
                <!-- <Button class="searchButton" type="success" @click="toAlertCheckResult()"  >数据检测</Button>                       -->
                <RadioGroup v-model="currentButton" @on-change="changeButton" type="button"  >
                    <Radio label="listShow" title="列表">列表<Icon type="ios-paper" size="10"></Icon></Radio>                            
                    <Radio label="barShow" title="柱状图">柱状图<Icon type="ios-pie" size="10"></Icon></Radio>
                    <Radio label="mapShow" title="地图">地图<Icon type="android-map" size="10"></Icon></Radio>                            
                </RadioGroup>                    
            </Col>                              
        </Row>
        <Row  v-show="listShow"  class="divStatis">
            <!-- 列表-->
            <div>
                <table class="statisTable">
                    <thead>
                        <tr>
                            <th style="width:100px;" rowspan="3">地区</th>
                            <th colspan="4">水果技术服务机构数（个）</th>
                            <th colspan="19">专业技术人员数量（人）</th>  
                            <!-- <th style="width:100px;" rowspan="3" v-show="searchModel.AreaCode=='530000000000'">操作</th>                           -->
                        </tr>
                        <tr>
                            <th rowspan="2">总数</th>
                            <th colspan="3">其中</th>
                            <th rowspan="2">总数</th>
                            <th colspan="2">其中</th>
                            <th colspan="2">按性别分</th>
                            <th colspan="4">按年龄分</th>
                            <th colspan="5">按学历层次分</th>
                            <th colspan="5">职称情况</th>
                        </tr>
                        <tr>
                            <th>州市级</th>
                            <th>县级</th>
                            <th>乡镇级</th>
                            <th>县乡级人数</th>
                            <th>州市级人数</th>
                            <th>男</th>
                            <th>女</th>
                            <th>30岁以下（含30）</th>
                            <th>30-40岁（含40）</th>
                            <th>40-50岁（含50）</th>
                            <th>50岁以上</th>
                            <th>硕士及以上</th>
                            <th>本科</th>
                            <th>大专</th>
                            <th>中专（技校）</th>
                            <th>其他</th>
                            <th>正高级职称</th>
                            <th>副高级职称</th>
                            <th>中级职称</th>
                            <th>初级职称</th>
                            <th>其他</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr v-for="(DataModel,index) in datalist" :key="index" :style="rowStyle(index,datalist.length)">
                            <td style="text-align:center;width:100px;">{{DataModel.AreaName}}</td>
                            <td>{{FormatBigNum(DataModel.InstituNum)}}</td>
                            <td>{{FormatBigNum(DataModel.InstituNum_City)}}</td>
                            <td>{{FormatBigNum(DataModel.InstituNum_Area)}}</td>
                            <td>{{FormatBigNum(DataModel.InstituNum_town)}}</td>
                            <td>{{FormatBigNum(DataModel.PeopleNum)}}</td>
                            <td>{{FormatBigNum(DataModel.PeopleNum_County)}}</td>
                            <td>{{FormatBigNum(DataModel.PeopleNum_City)}}</td>
                            <td>{{FormatBigNum(DataModel.PeopleNum_man)}}</td>
                            <td>{{FormatBigNum(DataModel.PeopleNum_woman)}}</td>
                            <td>{{FormatBigNum(DataModel.PeopleNum_age1)}}</td>
                            <td>{{FormatBigNum(DataModel.PeopleNum_age2)}}</td>
                            <td>{{FormatBigNum(DataModel.PeopleNum_age3)}}</td>
                            <td>{{FormatBigNum(DataModel.PeopleNum_age4)}}</td>
                            <td>{{FormatBigNum(DataModel.PeopleNum_xlss)}}</td>
                            <td>{{FormatBigNum(DataModel.PeopleNum_xlbk)}}</td>
                            <td>{{FormatBigNum(DataModel.PeopleNum_xldz)}}</td>
                            <td>{{FormatBigNum(DataModel.PeopleNum_xlzz)}}</td>
                            <td>{{FormatBigNum(DataModel.PeopleNum_xlqt)}}</td>
                            <td>{{FormatBigNum(DataModel.PeopleNum_zczgj)}}</td>
                            <td>{{FormatBigNum(DataModel.PeopleNum_zcfgj)}}</td>
                            <td>{{FormatBigNum(DataModel.PeopleNum_zczj)}}</td>
                            <td>{{FormatBigNum(DataModel.PeopleNum_zccj)}}</td>
                            <td>{{FormatBigNum(DataModel.PeopleNum_zcqt)}}</td> 
                            <!-- <td v-show="searchModel.AreaCode=='530000000000'" style="text-align:center">
                            <Button type="primary" size="small" @click="getDetail(DataModel.AreaCode)">详情</Button>
                            <Button type="primary" size="small" @click="Download(DataModel.AreaCode)">导出</Button>
                            </td>                              -->
                        </tr>
                    </tbody>
                </table>
            </div>
        </Row>
        <Row v-show="barShow"  class="divStatis">
            <!--饼图-->
            <Tabs type="card">
                <TabPane label="水果技术服务机构"><div  id="divBarOne" style="border:1px solid #D7DDE4; ">乡镇信息</div></TabPane>
                <TabPane label="专业技术人员">
                    <Tabs type="line">
                        <TabPane label="按地区分">
                            <div id="divBarTwo" style="border:1px solid #D7DDE4;"></div>
                        </TabPane>
                        <TabPane label="按性别分">
                            <div id="divBarThree" style="border:1px solid #D7DDE4; ">2</div>
                        </TabPane>
                        <TabPane  label="按年龄分">
                            <div id="divBarFour" style="border:1px solid #D7DDE4; ">3</div>
                        </TabPane>
                        <TabPane label="按学历分">
                            <div id="divBarFive" style="border:1px solid #D7DDE4; ">4</div>
                        </TabPane>
                        <TabPane label="职称情况">
                            <div id="divBarSix" style="border:1px solid #D7DDE4; ">4</div>
                        </TabPane>
                    </Tabs>
                </TabPane>
            </Tabs>
        </Row>
        <Row  v-show="mapShow" class="divStatis">
            <!--地图展示-->
            <Tabs type="card">
                <TabPane label="水果技术服务机构"><div  id="divMapOne" style="border:1px solid #D7DDE4; ">乡镇信息</div></TabPane>
                <TabPane label="专业技术人员">
                    <Tabs type="line">
                        <TabPane label="按地区分">
                            <div id="divMapTwo" style="border:1px solid #D7DDE4;"></div>
                        </TabPane>
                        <TabPane label="按性别分">
                            <div id="divMapThree" style="border:1px solid #D7DDE4; ">2</div>
                        </TabPane>
                        <TabPane  label="按年龄分">
                            <div id="divMapFour" style="border:1px solid #D7DDE4; ">3</div>
                        </TabPane>
                        <TabPane label="按学历分">
                            <div id="divMapFive" style="border:1px solid #D7DDE4; ">4</div>
                        </TabPane>
                        <TabPane label="职称情况">
                            <div id="divMapSix" style="border:1px solid #D7DDE4; ">4</div>
                        </TabPane>
                    </Tabs>
                </TabPane>
            </Tabs>
        </Row>
    </div>
</template>
<script>
export default {
    data() {
        return {
            showType:false,
            detailList:[],//详情页列表对象
            currentButton:'listShow',
            listShow:true,//列表显示控制器
            barShow:false,//饼图显示控制器
            mapShow:false,//地图显示控制器
            CurrentAreaName:'',
            userInfo: this.GetlocaStorage("fruuserinfo"),
            AreaList: this.SearchAreaList(this.GetlocaStorage("fruuserinfo").AreaCode),//所属行政区划数组,
            TableCodeList: this.GetGroupDict("ReportTableName"),//表名称
            CreateYearList: this.GetGroupDict("ReportYear"),//周期
            CycleList: this.GetGroupDict("ReportCycle"),//
            DataModel: {//编辑模型
                Id: 0,
                ReportId: '',
                InstituNum: '',
                InstituNum_City: '',
                InstituNum_Area: '',
                InstituNum_town: '',
                PeopleNum: '',
                PeopleNum_man: '',
                PeopleNum_woman: '',
                PeopleNum_age1: '',
                PeopleNum_age2: '',
                PeopleNum_age3: '',
                PeopleNum_age4: '',
                PeopleNum_xlss: '',
                PeopleNum_xlbk: '',
                PeopleNum_xldz: '',
                PeopleNum_xlzz: '',
                PeopleNum_xlqt: '',
                PeopleNum_zczgj: '',
                PeopleNum_zcfgj: '',
                PeopleNum_zczj: '',
                PeopleNum_zccj: '',
                PeopleNum_zcqt: '',
                People_County: '',
                People_City: ''
            },
            mapType:'',
            echartsItem0:['水果技术服务机构总数','州市级机构数','县级机构数','乡镇级机构数'],
            echartsItem1:['总人数','州市级人数','县乡级人数'],
            echartsItem2:['总人数','男','女'],
            echartsItem3:['总人数','30岁以下(含30)','30-40岁(含40)','40-50岁(含50)','50岁以上'],
            echartsItem4:['总人数','硕士及以上','本科','大专','中专(技校)','其他'],
            echartsItem5:['总人数','正高级职称','副高级职称','中级职称','初级职称','其他'],
            GeoData:'',
            //柱状图
            AreaData:[],
            InstituNumData: [],
            InstituNum_CityData: [],
            InstituNum_AreaData: [],
            InstituNum_townData: [],
            PeopleNumData: [],
            PeopleNum_CityData: [],
            PeopleNum_AreaData: [],
            PeopleNum_manData: [],
            PeopleNum_womanData: [],
            PeopleNum_age1Data: [],
            PeopleNum_age2Data: [],
            PeopleNum_age3Data: [],
            PeopleNum_age4Data: [],
            PeopleNum_xlssData: [],
            PeopleNum_xlbkData: [],
            PeopleNum_xldzData: [],
            PeopleNum_xlzzData: [],
            PeopleNum_xlqtData: [],
            PeopleNum_zczgjData: [],
            PeopleNum_zcfgjData: [],
            PeopleNum_zczjData: [],
            PeopleNum_zccjData: [],
            PeopleNum_zcqtData: [],
            barList0:[],
            barList1:[],
            barList2:[],
            barList3:[],
            barList4:[],
            barList5:[],
            //地图
            MapInstituNumData: [],
            MapInstituNum_CityData: [],
            MapInstituNum_AreaData: [],
            MapInstituNum_townData: [],
            MapPeopleNumData: [],
            MapPeopleNum_CityData: [],
            MapPeopleNum_AreaData: [],
            MapPeopleNum_manData: [],
            MapPeopleNum_womanData: [],
            MapPeopleNum_age1Data: [],
            MapPeopleNum_age2Data: [],
            MapPeopleNum_age3Data: [],
            MapPeopleNum_age4Data: [],
            MapPeopleNum_xlssData: [],
            MapPeopleNum_xlbkData: [],
            MapPeopleNum_xldzData: [],
            MapPeopleNum_xlzzData: [],
            MapPeopleNum_xlqtData: [],
            MapPeopleNum_zczgjData: [],
            MapPeopleNum_zcfgjData: [],
            MapPeopleNum_zczjData: [],
            MapPeopleNum_zccjData: [],
            MapPeopleNum_zcqtData: [],
            mapList0:[],
            mapList1:[],
            mapList2:[],
            mapList3:[],
            mapList4:[],
            mapList5:[],
            //查询模型：根据需求删除不不要查询条件
            searchModel: {
                ReportCode: 'FruTecPromotion',
                FillInYear: new Date().getFullYear()+"",
                TimesType: '',
                AreaCode: this.GetlocaStorage("fruuserinfo").AreaCode,
                Status:'',
                PageNumber: 1, PageSize: 20
            },
            datalist:[],
            ctx: this,//table数据上下文
            clientHeight: window.innerHeight - 220,//表格默认高度
        }
    },
    mounted() {
        //table高度计算方法
        const that = this;
        window.onresize = () => {
            return (() => {
                that.clientHeight = window.innerHeight - 220;
            })()
        };
    },
    methods: {
       //展示切换
        changeButton:function(n){
            if(n=="listShow")
            {
                this.listShow=true;//显示列表
                this.barShow=false;
                this.mapShow=false;
            }
            else if(n=="barShow")
            {
                this.listShow=false;
                this.barShow=true;//显示饼图
                this.mapShow=false;
            }
             else if(n=="mapShow")
            {
                this.listShow=false;
                this.barShow=false;//显示地图
                this.mapShow=true;
            }
            else{
                 this.listShow=true;//默认显示列表
                 this.barShow=false;
                 this.mapShow=false;
            }
        },
        getDetail(AreaCode){
          var self = this;
          this.$http.get("FruTecPromotion/GetStatisListData", {params: {AreaCode: AreaCode,FillInYear: this.searchModel.FillInYear}}).then(function(res) {
          if (res.data.status == 1) {
            self.detailList = res.data.model;
            self.showType = true;            
          } else {
            self.$Modal.error({ title: "提示信息", content: res.data.message });
          }
        });
        },
        Download(AreaCode){
          window.open(this.$http.defaults.baseURL + "FruTecPromotion/GetStatisExcel?FillInYear="  + this.searchModel.FillInYear + "&&AreaCode=" + AreaCode);
        },
        GetData(){
          this.getListData();
        },
        rowStyle(index,length){  
            let striprow ={ backgroundColor: '#ebf7ff'};    
            if(index==(length-1)){       
                return {
                    backgroundColor: '#f9c912'
                }
            }
            else if(index%2 !=0){
                return striprow;
            }
             else{
               return 
           }
        },
        rowclass(item,index){
          let striprow ={
            backgroundColor: '#ebf7ff'
          }
          let cityrow = {
             backgroundColor: '#ff6600'
          }
          let provinrow = {
            backgroundColor: '#183'
          }
            if(index %2 ==0){
              if(item.tag==1){
                return cityrow
              }
              else if(item.tag==2){
                return provinrow
              }              
            }
            else{
              if(item.tag==1){
                return cityrow
              }
              else if(item.tag==2){
                return provinrow
              }
              else{
                return striprow
              }
            }
        },
        getListData(){
            var self = this;
             //判断当前用户是否为省级账号
            if(self.userInfo.AreaCode=="530000000000")
            {
                // self.isProvince=true;
                self.mapType=self.searchModel.AreaCode;
            }
            else{
                self.mapType=self.userInfo.AreaCode;
            }
            //柱状图
            self.AreaData=[];
            self.InstituNumData= [];
            self.InstituNum_CityData= [];
            self.InstituNum_AreaData= [];
            self.InstituNum_townData= [];
            self.PeopleNumData= [];
            self.PeopleNum_CityData= [];
            self.PeopleNum_AreaData= [];
            self.PeopleNum_manData= [];
            self.PeopleNum_womanData= [];
            self.PeopleNum_age1Data= [];
            self.PeopleNum_age2Data= [];
            self.PeopleNum_age3Data= [];
            self.PeopleNum_age4Data= [];
            self.PeopleNum_xlssData= [];
            self.PeopleNum_xlbkData= [];
            self.PeopleNum_xldzData= [];
            self.PeopleNum_xlzzData= [];
            self.PeopleNum_xlqtData= [];
            self.PeopleNum_zczgjData= [];
            self.PeopleNum_zcfgjData= [];
            self.PeopleNum_zczjData= [];
            self.PeopleNum_zccjData= [];
            self.PeopleNum_zcqtData= [];
            self.barList0=[];
            self.barList1=[];
            self.barList2=[];
            self.barList3=[];
            self.barList4=[];
            self.barList5=[];
            //地图
            self.MapInstituNumData= [];
            self.MapInstituNum_CityData= [];
            self.MapInstituNum_AreaData= [];
            self.MapInstituNum_townData= [];
            self.MapPeopleNumData= [];
            self.MapPeopleNum_CityData= [];
            self.MapPeopleNum_AreaData= [];
            self.MapPeopleNum_manData= [];
            self.MapPeopleNum_womanData= [];
            self.MapPeopleNum_age1Data= [];
            self.MapPeopleNum_age2Data= [];
            self.MapPeopleNum_age3Data= [];
            self.MapPeopleNum_age4Data= [];
            self.MapPeopleNum_xlssData= [];
            self.MapPeopleNum_xlbkData= [];
            self.MapPeopleNum_xldzData= [];
            self.MapPeopleNum_xlzzData= [];
            self.MapPeopleNum_xlqtData= [];
            self.MapPeopleNum_zczgjData= [];
            self.MapPeopleNum_zcfgjData= [];
            self.MapPeopleNum_zczjData= [];
            self.MapPeopleNum_zccjData= [];
            self.MapPeopleNum_zcqtData= [];
            self.mapList0=[];
            self.mapList1=[];
            self.mapList2=[];
            self.mapList3=[];
            self.mapList4=[];
            self.mapList5=[];
            self.GeoData=self.GetGeoData(self.mapType); 
            this.$http.get('FruTecPromotion/GetStatisListData',{params: {AreaCode: this.searchModel.AreaCode,FillInYear: this.searchModel.FillInYear}}).then(function(res){
                if(res.data.status==1){
                    self.datalist = res.data.model;
                    if(res.data.model.length >1)
                    self.CurrentAreaName=res.data.model[res.data.model.length-1].AreaName=="合计"?'云南省':res.data.model[res.data.model.length-1].AreaName;
                    for(var i=0;i<res.data.model.length-1;i++)
                    {
                        //柱状图
                        self.AreaData.push(res.data.model[i].AreaName);
                        self.InstituNumData.push(res.data.model[i].InstituNum);
                        self.InstituNum_CityData.push(res.data.model[i].InstituNum_City);
                        self.InstituNum_AreaData.push(res.data.model[i].InstituNum_Area);
                        self.InstituNum_townData.push(res.data.model[i].InstituNum_town);
                        self.PeopleNumData.push(res.data.model[i].PeopleNum);
                        self.PeopleNum_CityData.push(res.data.model[i].PeopleNum_County);
                        self.PeopleNum_AreaData.push(res.data.model[i].PeopleNum_City);
                        self.PeopleNum_manData.push(res.data.model[i].PeopleNum_man);
                        self.PeopleNum_womanData.push(res.data.model[i].PeopleNum_woman);
                        self.PeopleNum_age1Data.push(res.data.model[i].PeopleNum_age1);
                        self.PeopleNum_age2Data.push(res.data.model[i].PeopleNum_age2);
                        self.PeopleNum_age3Data.push(res.data.model[i].PeopleNum_age3);
                        self.PeopleNum_age4Data.push(res.data.model[i].PeopleNum_age4);
                        self.PeopleNum_xlssData.push(res.data.model[i].PeopleNum_xlss);
                        self.PeopleNum_xlbkData.push(res.data.model[i].PeopleNum_xlbk);
                        self.PeopleNum_xldzData.push(res.data.model[i].PeopleNum_xldz);
                        self.PeopleNum_xlzzData.push(res.data.model[i].PeopleNum_xlzz);
                        self.PeopleNum_xlqtData.push(res.data.model[i].PeopleNum_xlqt);
                        self.PeopleNum_zczgjData.push(res.data.model[i].PeopleNum_zczgj);
                        self.PeopleNum_zcfgjData.push(res.data.model[i].PeopleNum_zcfgj);
                        self.PeopleNum_zczjData.push(res.data.model[i].PeopleNum_zcfgj);
                        self.PeopleNum_zccjData.push(res.data.model[i].PeopleNum_zccj);
                        self.PeopleNum_zcqtData.push(res.data.model[i].PeopleNum_zcqt);
                        //地图数据
                        self.MapInstituNumData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].InstituNum});
                        self.MapInstituNum_CityData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PeopleNum_County});
                        self.MapInstituNum_AreaData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].InstituNum_Area});
                        self.MapInstituNum_townData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].InstituNum_town});
                        self.MapPeopleNumData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PeopleNum});
                        self.MapPeopleNum_CityData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PeopleNum_Count});
                        self.MapPeopleNum_AreaData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PeopleNum_City});
                        self.MapPeopleNum_manData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PeopleNum_man});
                        self.MapPeopleNum_womanData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PeopleNum_woman});
                        self.MapPeopleNum_age1Data.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PeopleNum_age1});
                        self.MapPeopleNum_age2Data.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PeopleNum_age2});
                        self.MapPeopleNum_age3Data.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PeopleNum_age3});
                        self.MapPeopleNum_age4Data.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PeopleNum_age4});
                        self.MapPeopleNum_xlssData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PeopleNum_xlss});
                        self.MapPeopleNum_xlbkData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PeopleNum_xlbk});
                        self.MapPeopleNum_xldzData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PeopleNum_xldz});
                        self.MapPeopleNum_xlzzData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PeopleNum_xlzz});
                        self.MapPeopleNum_xlqtData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PeopleNum_xlqt});
                        self.MapPeopleNum_zczgjData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PeopleNum_zczgj});
                        self.MapPeopleNum_zcfgjData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PeopleNum_zcfgj});
                        self.MapPeopleNum_zczjData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PeopleNum_zcfgj});
                        self.MapPeopleNum_zccjData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PeopleNum_zccj});
                        self.MapPeopleNum_zcqtData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].PeopleNum_zcqt});
                    }
                    self.barList0.push(self.InstituNumData,self.InstituNum_CityData,self.InstituNum_AreaData,self.InstituNum_townData);
                    self.barList1.push(self.PeopleNumData,self.PeopleNum_CityData,self.PeopleNum_AreaData);
                    self.barList2.push(self.PeopleNumData,self.PeopleNum_manData,self.PeopleNum_womanData);
                    self.barList3.push(self.PeopleNumData,self.PeopleNum_age1Data,self.PeopleNum_age2Data,self.PeopleNum_age3Data,self.PeopleNum_age4Data);
                    self.barList4.push(self.PeopleNumData,self.PeopleNum_xlssData,self.PeopleNum_xlbkData,self.PeopleNum_xldzData,self.PeopleNum_xlzzData,self.PeopleNum_xlqtData);
                    self.barList5.push(self.PeopleNumData,self.PeopleNum_zczgjData,self.PeopleNum_zcfgjData,self.PeopleNum_zczjData,self.PeopleNum_zccjData,self.PeopleNum_zcqtData);
                    self.mapList0.push(self.MapInstituNumData,self.MapInstituNum_CityData,self.MapInstituNum_AreaData,self.MapInstituNum_townData);
                    self.mapList1.push(self.MapPeopleNumData,self.MapPeopleNum_CityData,self.MapPeopleNum_AreaData);
                    self.mapList2.push(self.MapPeopleNumData,self.MapPeopleNum_manData,self.MapPeopleNum_womanData);
                    self.mapList3.push(self.MapPeopleNumData,self.MapPeopleNum_age1Data,self.MapPeopleNum_age2Data,self.MapPeopleNum_age3Data,self.MapPeopleNum_age4Data);
                    self.mapList4.push(self.MapPeopleNumData,self.MapPeopleNum_xlssData,self.MapPeopleNum_xlbkData,self.MapPeopleNum_xldzData,self.MapPeopleNum_xlzzData,self.MapPeopleNum_xlqtData);
                    self.mapList5.push(self.MapPeopleNumData,self.MapPeopleNum_zczgjData,self.MapPeopleNum_zcfgjData,self.MapPeopleNum_zczjData,self.MapPeopleNum_zccjData,self.MapPeopleNum_zcqtData);
                    self.showEcharts();
                }else{
                    self.$Modal.error({title:'提示信息',content:res.data.message});
                }
            })
        },
        showEcharts(){//显示柱状图
            //显示柱状图
            var self=this;
            var containerBarOne=document.getElementById('divBarOne');
            var containerBarTwo=document.getElementById('divBarTwo');
            var containerBarThree=document.getElementById('divBarThree');
            var containerBarFour=document.getElementById('divBarFour');
            var containerBarFive=document.getElementById('divBarFive');
            var containerBarSix=document.getElementById('divBarSix');
            var containerTable=document.getElementsByClassName('ivu-col ivu-col-span-4');
            // //用于使chart自适应高度和宽度,通过窗体高宽计算容器高宽
            var resizeContainerBar = function () {
                //containerTable[0].clientWidth 左侧菜单栏的宽度
                containerBarOne.style.width = (window.innerWidth- containerTable[0].clientWidth-20)+'px';
                containerBarOne.style.height = (window.innerHeight-280)+'px';
                containerBarTwo.style.width = (window.innerWidth- containerTable[0].clientWidth-20)+'px';
                containerBarTwo.style.height = (window.innerHeight-330)+'px';
                containerBarThree.style.width = (window.innerWidth- containerTable[0].clientWidth-20)+'px';
                containerBarThree.style.height = (window.innerHeight-330)+'px';
                containerBarFour.style.width = (window.innerWidth- containerTable[0].clientWidth-20)+'px';
                containerBarFour.style.height = (window.innerHeight-330)+'px';
                containerBarFive.style.width = (window.innerWidth- containerTable[0].clientWidth-20)+'px';
                containerBarFive.style.height = (window.innerHeight-330)+'px';
                containerBarSix.style.width = (window.innerWidth- containerTable[0].clientWidth-20)+'px';
                containerBarSix.style.height = (window.innerHeight-330)+'px';
            };
            //设置容器高宽
            resizeContainerBar();
            var myBarOne = myEcharts.init(containerBarOne, 'shine');
            var myBarTwo = myEcharts.init(containerBarTwo, 'shine');
            var myBarThree = myEcharts.init(containerBarThree, 'shine');
            var myBarFour = myEcharts.init(containerBarFour, 'shine');
            var myBarFive = myEcharts.init(containerBarFive, 'shine');
            var myBarSix = myEcharts.init(containerBarSix, 'shine');
            var BarNameOne=this.searchModel.FillInYear+'年(五)'+self.CurrentAreaName+'水果技术服务机构柱状统计图(全面统计)';
            var BarNameTwo=this.searchModel.FillInYear+'年(五)'+self.CurrentAreaName+'水果专业技术人员按地区分柱状统计图(全面统计)';
            var BarNameThree=this.searchModel.FillInYear+'年(五)'+self.CurrentAreaName+'水果专业技术人员按性别分柱状统计图(全面统计)';
            var BarNameFour=this.searchModel.FillInYear+'年(五)'+self.CurrentAreaName+'水果专业技术人员按年龄分柱状统计图(全面统计)';
            var BarNameFive=this.searchModel.FillInYear+'年(五)'+self.CurrentAreaName+'水果专业技术人员按学历层次分柱状统计图(全面统计)';
            var BarNameSix=this.searchModel.FillInYear+'年(五)'+self.CurrentAreaName+'水果专业技术人员职称情况柱状统计图(全面统计)';
            var optionBarOne = self.GetBarOption(BarNameOne,self.AreaData,self.echartsItem0,self.barList0);
            var optionBarTwo = self.GetBarOption(BarNameTwo,self.AreaData,self.echartsItem1,self.barList1);
            var optionBarThree = self.GetBarOption(BarNameThree,self.AreaData,self.echartsItem2,self.barList2);
            var optionBarFour = self.GetBarOption(BarNameFour,self.AreaData,self.echartsItem3,self.barList3);
            var optionBarFive = self.GetBarOption(BarNameFive,self.AreaData,self.echartsItem4,self.barList4);
            var optionBarSix = self.GetBarOption(BarNameSix,self.AreaData,self.echartsItem5,self.barList5);
            myBarOne.setOption(optionBarOne);
            myBarTwo.setOption(optionBarTwo);
            myBarThree.setOption(optionBarThree);
            myBarFour.setOption(optionBarFour);
            myBarFive.setOption(optionBarFive);
            myBarSix.setOption(optionBarSix);
            //******************显示地图
            var self=this;
            var containerMapOne=document.getElementById('divMapOne');
            var containerMapTwo=document.getElementById('divMapTwo');
            var containerMapThree=document.getElementById('divMapThree');
            var containerMapFour=document.getElementById('divMapFour');
            var containerMapFive=document.getElementById('divMapFive');
            var containerMapSix=document.getElementById('divMapSix');
            // //用于使chart自适应高度和宽度,通过窗体高宽计算容器高宽
            var resizeContainerMap = function () {
                //containerTable[0].clientWidth 左侧菜单栏的宽度
                containerMapOne.style.width = (window.innerWidth- containerTable[0].clientWidth-20)+'px';
                containerMapOne.style.height = (window.innerHeight-280)+'px';
                containerMapTwo.style.width = (window.innerWidth- containerTable[0].clientWidth-20)+'px';
                containerMapTwo.style.height = (window.innerHeight-330)+'px';
                containerMapThree.style.width = (window.innerWidth- containerTable[0].clientWidth-20)+'px';
                containerMapThree.style.height = (window.innerHeight-330)+'px';
                containerMapFour.style.width = (window.innerWidth- containerTable[0].clientWidth-20)+'px';
                containerMapFour.style.height = (window.innerHeight-330)+'px';
                containerMapFive.style.width = (window.innerWidth- containerTable[0].clientWidth-20)+'px';
                containerMapFive.style.height = (window.innerHeight-330)+'px';
                containerMapSix.style.width = (window.innerWidth- containerTable[0].clientWidth-20)+'px';
                containerMapSix.style.height = (window.innerHeight-330)+'px';
            };
            //设置容器高宽
            resizeContainerMap();

            var myMapOne = myEcharts.init(containerMapOne, 'shine');
            var myMapTwo = myEcharts.init(containerMapTwo, 'shine');
            var myMapThree = myEcharts.init(containerMapThree, 'shine');
            var myMapFour = myEcharts.init(containerMapFour, 'shine');
            var myMapFive = myEcharts.init(containerMapFive, 'shine');
            var myMapSix = myEcharts.init(containerMapSix, 'shine');
            var MapNameOne=this.searchModel.FillInYear+'年(五)'+self.CurrentAreaName+'水果技术服务机构统计地区分布图(全面统计)';
            var MapNameTwo=this.searchModel.FillInYear+'年(五)'+self.CurrentAreaName+'水果专业技术人员统计地区分布图(全面统计)';
            var MapNameThree=this.searchModel.FillInYear+'年(五)'+self.CurrentAreaName+'水果专业技术人员按性别分统计地区分布图(全面统计)';
            var MapNameFour=this.searchModel.FillInYear+'年(五)'+self.CurrentAreaName+'水果专业技术人员按年龄分统计地区分布图(全面统计)';
            var MapNameFive=this.searchModel.FillInYear+'年(五)'+self.CurrentAreaName+'水果专业技术人员按学历层次分统计地区分布图(全面统计)';
            var MapNameSix=this.searchModel.FillInYear+'年(五)'+self.CurrentAreaName+'水果专业技术人员职称情况统计地区分布图(全面统计)';
            var optionMapOne = self.GetMapOption(MapNameOne,self.GeoData,self.mapType,self.echartsItem0,self.mapList0);
            var optionMapTwo = self.GetMapOption(MapNameTwo,self.GeoData,self.mapType,self.echartsItem1,self.mapList1);
            var optionMapThree = self.GetMapOption(MapNameThree,self.GeoData,self.mapType,self.echartsItem2,self.mapList2);
            var optionMapFour = self.GetMapOption(MapNameFour,self.GeoData,self.mapType,self.echartsItem3,self.mapList3);
            var optionMapFive = self.GetMapOption(MapNameFive,self.GeoData,self.mapType,self.echartsItem4,self.mapList4);
            var optionMapSix = self.GetMapOption(MapNameSix,self.GeoData,self.mapType,self.echartsItem5,self.mapList5);
            myMapOne.setOption(optionMapOne);
            myMapTwo.setOption(optionMapTwo);
            myMapThree.setOption(optionMapThree);
            myMapFour.setOption(optionMapFour);
            myMapFive.setOption(optionMapFive);
            myMapSix.setOption(optionMapSix);
            //用于使chart自适应高度和宽度
            window.onresize = function () {
                //重置容器高宽
                resizeContainerBar();
                resizeContainerMap();
                myMapOne.resize();
                myMapTwo.resize();
                myMapThree.resize();
                myMapFour.resize();
                myMapFive.resize();
                myMapSix.resize();
                myBarOne.resize();
                myBarTwo.resize();
                myBarThree.resize();
                myBarFour.resize();
                myBarFive.resize();
                myBarSix.resize();
            };
        },
        checkData(){
            var self = this;   
            let list = this.datalist;
            let message='';
            let isOk = true;
            for(let i=0;i<list.length;i++){ 
                let Item = list[i];             
            if((Item.InstituNum_City*1+Item.InstituNum_Area*1+ Item.InstituNum_town*1) != Item.InstituNum*1){
                isOk = false;
                    message += Item.AreaName+"水果技术服务机构数应等于其中子项加起来的和!</br>";                      
                }
                if((Item.PeopleNum_County*1+Item.PeopleNum_City*1) != Item.PeopleNum*1){
                    isOk = false;
                    message += Item.AreaName+"专业技术人员数量应等于其中子项加起来的和!</br>";                                               
                }
                if((Item.PeopleNum_man*1+Item.PeopleNum_woman*1) != Item.PeopleNum*1){   
                    isOk = false;             
                    message += Item.AreaName+"专业技术人员数量应等于按性别分加起来的和!</br>";                                       
                }
                if((Item.PeopleNum_age1*1+Item.PeopleNum_age2*1+Item.PeopleNum_age3*1+Item.PeopleNum_age4*1) != Item.PeopleNum*1){
                    isOk = false;
                    message += Item.AreaName+"专业技术人员数量应等于按年龄分加起来的和!</br>";                                    
                }
                if((Item.PeopleNum_xlss*1+Item.PeopleNum_xlbk*1+Item.PeopleNum_xldz*1+Item.PeopleNum_xlzz*1+Item.PeopleNum_xlqt*1) != Item.PeopleNum*1){
                    isOk = false;
                message += Item.AreaName+"专业技术人员数量应等于按学历层次分加起来的和!</br>";                                     
                }
                if((Item.PeopleNum_zczgj*1+Item.PeopleNum_zcfgj*1+Item.PeopleNum_zczj*1+Item.PeopleNum_zccj*1+Item.PeopleNum_zcqt*1) != Item.PeopleNum*1){
                    isOk = false;
                message += Item.AreaName+"专业技术人员数量应等于按职称情况分加起来的和!</br>";                                     
                }
                
            }
            if(isOk){
                message += '数据检测无误！';
            }
            return message;
        },
        toAlertCheckResult(){ 
            var message  = this.checkData();   
            this.$Modal.warning({
                title:'提示信息',
                content:message
            });
        },
        currentYear() {
           let year = new Date().getFullYear();
           let month = new Date().getMonth();
            if (month > 1) {
                this.searchModel.FillInYear = year.toString();
            } else {
               this.searchModel.FillInYear = (year - 1).toString();
              }
        }
    },
    //创建Vue页面方法
    created: function () {
        this.currentYear();
        this.getListData();
    },
    watch: {
        //需要监听的在此处新增监听对象
    }
}
</script>
